<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/common/taglibs.jsp" %>


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><spring:message code="dashboard.title" /></title>
<tags:script source="/js/jquery/jquery-1.6.2.js" />
<tags:script source="/js/jquery/ui/jquery-ui-1.8.16.min.js" />
<tags:script source="/js/jquery/jquery.form.js" />
<tags:script source="/js/jquery/jquery.validate.js" />
<tags:script source="/js/jquery/jquery.qtip.js" />
<tags:script source="/js/main.js" />
<tags:style source="/css/jquery/ui/jquery-ui-1.8.16.css" />
<tags:style source="/css/jquery/jquery.qtip.css" />
<link href="<c:url value='/css/cipe-ver2.css' />" rel="stylesheet" type="text/css" />
<script>
 var response1 ="";
	$(document).ready(function() {
		$("#loginForm").validate({
			rules : {
				loginName : {
					required : true
				},
				password : {
					required : true
				}
			}
		});
		
		var rev = '<fmt:message key="project.revision"/>';
		if(rev != '\${buildNumber}') {
			$('#revisionnumber').text('<spring:message code="webapp.version" />rev' + rev);
		}
	});
   
	function loginFormSubmitComplete(responce) {
	  
		if ($.trim(responce) == 'success') {
		 //response1 = "success";
		//  alert(response1);
		
			top.location.href = 'secure/showDashboard.do';
		} else {
		  // alert(responce );
			$('#errorMSG').html(responce);
		}
	}
</script>
</head>
<body>
<script>
$.ajax({
cache: false,
dataType: "text",
  url: "secure/checkSession.do",
      success: function(data){
       // alert("loginform...."+$.trim(data));
       if ($.trim(data) == 'success') {
       top.location.href = 'secure/showDashboard.do';
    }
  }
});
// top.location.href = 'secure/showDashboard.do';
 //alert(response1);
</script>
<div id="login_container">
	<div id="header">
	    <div id="logo">
	    	<a href="../secure/showDashboard.do" id="logoLink" url='showDashboard.do'>
	    	<img src="images/cipelogo.gif" width="90" height="75" alt="CIPE logo" /></a>
	    </div>	
        <div id="pageTitle"></div>
		<div id="banner">
			<img src="images/cipe-banner.png"><br>
			<b><spring:message code="baner.title" /></b><span style="font-size: 10px;"><span id="revisionnumber">&nbsp;</span></span></br>
		</div>
		<br class="clear" />
	</div>
	<!-- id="nav-bar" -->
	<div class="cipe-sub-nav">
		<ul class="floatL">
			<li><a href="javascript:void(0);" class="active"><spring:message code="dashboard.tabs.crms.home" /></a></li>
		</ul>
		<br class="clear" />
	</div>
	
	<div class="login">
		<span><spring:message code="login.heading.username" /><br /><b>Member Login</b></span>
	    <div class="clear15"></div>
	    <div class="login_cont">
			<c:url value="/login.do" var="loginUrl" />
			<form:form name="loginForm" id="loginForm" action="${loginUrl}" method="post" commandName="user">
				<label class="l_label">&nbsp;</label> <div class="error" id="errorMSG">${errorMessage} ${errorMessage1}</div>
			   	<div class="clear10"></div>
			   	<label class="l_label">User Name:<c:out value="${errorMessage}"/></label>
			   	<form:input path="loginName" cssClass="l_field"/>
		       <div class="clear10"></div>
		       <label class="l_label">Password:</label>
		       <form:password path="password" cssClass="l_field"/>
		       <div class="clear10"></div>
		       <label class="l_label"></label>
		       <div class="floatL" style="width:275px;">
		       	<div class="floatL"><input type="checkbox" /> Remember Me<br /><a href="#">Forgot Password?</a></div>
		           <div class="floatR">
		           <sj:submit id="loginFormSubmit" key="login.button.login" validate="true" submitComplete="loginFormSubmitComplete" cssClass="l_button"/>
		           <input type="reset" value="<spring:message code='login.button.reset' />" class="l_button"/>
		       </div>
			       <br class="clear" />
			</form:form>
	    </div>
	</div>
	<br class="clear" />
</div>
</body>
</html>
